//package com.song.seckill.netty.config;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.CommandLineRunner;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//@Configuration
//public class NettyStarter {
//
//    @Autowired
//    private ServerBootstrap serverBootstrap;
//
//    @Bean
//    public CommandLineRunner startServer() {
//        return args -> {
//            ChannelFuture future = serverBootstrap.bind().sync();
//            System.out.println("Netty server started on port 8888");
//            future.channel().closeFuture().sync(); // 阻塞等待关闭
//        };
//    }
//
//    // 优雅关闭钩子
//    @Bean
//    public GracefulShutdown gracefulShutdown() {
//        return new GracefulShutdown();
//    }
//
//
//}
